package com.hd.service.activiti.impl;

import java.util.List;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hd.dao.BaseDao;
import com.hd.entity.activiti.ElementIns;
import com.hd.service.activiti.ElementInsService;

/**
 * 节点流程运行轨迹业务操作
 * 
 * @author hzhh123 2018年8月3日下午12:01:28
 */
@Service("elementInsService")
public class ElementInsServiceImpl implements ElementInsService {
	@Autowired
	private BaseDao<ElementIns, String> elementInsDao;

	@Override
	public void save(ElementIns elementIns) {
		String id=UUID.randomUUID().toString();
		elementIns.setId(id);
		elementInsDao.save(elementIns);
	}

	@Override
	public void update(ElementIns elementIns) {
		elementInsDao.update(elementIns);

	}

	@Override
	public void delete(String id) {
		elementInsDao.delete(ElementIns.class, id);
	}

	@Override
	public ElementIns get(String id) {
		return elementInsDao.get(ElementIns.class, id);
	}

	@Override
	public List<ElementIns> getNextElementIns(String startElement) {
		String hql = "from ElementIns where startElement=?";
		return elementInsDao.find(hql, startElement);
	}

	@Override
	public List<ElementIns> findByProcdefId(String procdefId) {
		String hql = "from ElementIns where procdefId=?";
		return elementInsDao.find(hql, procdefId);
	}

}
